Skip to content

nvmeof: add volume cloning capability - #6277

Merged
mergify[bot] merged 2 commits into
ceph:develfrom
gadididi:nvmeof/clone_feature
Jul 29, 2026
Merged

nvmeof: add volume cloning capability#6277
mergify[bot] merged 2 commits into
ceph:develfrom
gadididi:nvmeof/clone_feature

Conversation

@gadididi

@gadididi gadididi commented May 14, 2026

Copy link
Copy Markdown
Contributor

enable volume cloning support for nvmeof CSI driver by declaring CLONE_VOLUME capability. The RBD backend automatically handles all clone operations (snapshot-to-volume restore and volume-to-volume cloning) when VolumeContentSource is present in CreateVolume request.

The NVMeoF driver adds debug logging to track clone operations and creates namespaces pointing to the cloned RBD images. No changes to the NVMeoF gateway are required since clones are transparent at the block device level.

Need to test it!

Checklist:

  • Commit Message Formatting: Commit titles and messages follow
    guidelines in the developer
    guide
    .
  • Reviewed the developer guide on Submitting a Pull
    Request
  • Pending release
    notes

    updated with breaking and/or notable changes for the next major release.
  • Documentation has been updated, if necessary.
  • Unit tests have been added, if necessary.
  • Integration tests have been added, if necessary.

Show available bot commands

These commands are normally not required, but in case of issues, leave any of
the following bot commands in an otherwise empty comment in this PR:

  • /retest ci/centos/<job-name>: retest the <job-name> after unrelated
    failure (please report the failure too!)

@gadididi gadididi self-assigned this May 14, 2026
@gadididi gadididi added the component/nvme-of Issues and PRs related to NVMe-oF. label May 14, 2026
@gadididi
gadididi requested review from Copilot and nixpanic and removed request for Copilot May 14, 2026 13:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR starts enabling NVMe-oF volume cloning by advertising the CSI CLONE_VOLUME controller capability and passing clone-related CreateVolume requests through to the RBD backend, while adding debug logging for clone sources.

Changes:

  • Adds RPC_CLONE_VOLUME to the NVMe-oF controller capabilities.
  • Logs whether CreateVolume is using a snapshot or volume content source.
  • Documents that clone handling is delegated to the RBD backend.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
internal/nvmeof/driver/driver.go Advertises NVMe-oF support for CSI volume cloning.
internal/nvmeof/controller/controllerserver.go Adds clone-source debug logging before delegating CreateVolume to the RBD backend.

Comment thread internal/nvmeof/controller/controllerserver.go Outdated
csi.ControllerServiceCapability_RPC_MODIFY_VOLUME,
csi.ControllerServiceCapability_RPC_EXPAND_VOLUME,
csi.ControllerServiceCapability_RPC_CREATE_DELETE_SNAPSHOT,
csi.ControllerServiceCapability_RPC_CLONE_VOLUME,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add later.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include an e2e test for cloning with this PR, thanks!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed that. I am on it!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@gadididi
gadididi marked this pull request as ready for review May 27, 2026 12:14
@gadididi gadididi changed the title [WIP] nvmeof: add volume cloning capability nvmeof: add volume cloning capability Jun 3, 2026
@gadididi
gadididi force-pushed the nvmeof/clone_feature branch from 7fa3701 to b17c26b Compare June 7, 2026 12:40
@gadididi
gadididi requested a review from Copilot June 7, 2026 13:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment thread e2e/nvmeof.go Outdated
Comment thread internal/nvmeof/controller/controllerserver.go
Comment thread e2e/nvmeof.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@gadididi
gadididi requested a review from nixpanic June 8, 2026 12:14
nixpanic
nixpanic previously approved these changes Jun 8, 2026
Comment thread e2e/nvmeof.go
err = createPVCAndvalidatePV(f.ClientSet, sourcePVC, deployTimeout)
Expect(err).ShouldNot(HaveOccurred())

ginkgo.By("Binding source PVC to an application")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need to bind the source volume to an app, that is validated in other tests already too.

@gadididi gadididi Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohh ok I can remove it. I thought you want both to be bind to app .
I will remove it after the test will be finish

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having both is ok, but not required. The cloned volume needs complete testing.

The current PR is fine by me, no need to update it unless there is something else you want to improve too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I will keep it as is.
looks like the cloning test passed!

  �[1mSTEP:�[0m Creating a clone of the source PVC �[38;5;243m@ 06/08/26 13:16:31.494�[0m
  I0608 13:16:31.498376   79259 pvc.go:61] Waiting up to &PersistentVolumeClaim{ObjectMeta:{nvmeof-pvc-clone  nvmeof-3536    0 0001-01-01 00:00:00 +0000 UTC <nil> <nil> map[] map[] [] [] []},Spec:PersistentVolumeClaimSpec{AccessModes:[ReadWriteOnce],Resources:VolumeResourceRequirements{Limits:ResourceList{},Requests:ResourceList{storage: {{67108864 0} {<nil>}  BinarySI},},},VolumeName:,Selector:nil,StorageClassName:*e2e-nvmeof-7592-sc,VolumeMode:nil,DataSource:&TypedLocalObjectReference{APIGroup:nil,Kind:PersistentVolumeClaim,Name:nvmeof-pvc,},DataSourceRef:nil,VolumeAttributesClassName:nil,},Status:PersistentVolumeClaimStatus{Phase:,AccessModes:[],Capacity:ResourceList{},Conditions:[]PersistentVolumeClaimCondition{},AllocatedResources:ResourceList{},AllocatedResourceStatuses:map[ResourceName]ClaimResourceStatus{},CurrentVolumeAttributesClassName:nil,ModifyVolumeStatus:nil,},} to be in Bound state
  I0608 13:16:31.498423   79259 pvc.go:64] waiting for PVC nvmeof-pvc-clone (0 seconds elapsed)
  I0608 13:16:33.499329   79259 pvc.go:64] waiting for PVC nvmeof-pvc-clone (2 seconds elapsed)
  I0608 13:16:33.503706   79259 pvc.go:86] PVC nvmeof-pvc-clone Event: Provisioning - External provisioner is provisioning volume for claim "nvmeof-3536/nvmeof-pvc-clone"
  I0608 13:16:33.503736   79259 pvc.go:86] PVC nvmeof-pvc-clone Event: ExternalProvisioning - Waiting for a volume to be created either by the external provisioner 'nvmeof.csi.ceph.com' or manually by the system administrator. If volume creation is delayed, please verify that the provisioner is running and correctly registered.
  I0608 13:16:35.499332   79259 pvc.go:64] waiting for PVC nvmeof-pvc-clone (4 seconds elapsed)
  I0608 13:16:35.503453   79259 pv.go:468] Waiting for PV pvc-ff99cd28-102e-47fc-8d14-8aaec7c9a280 to bind to PVC nvmeof-pvc-clone
  I0608 13:16:35.503551   79259 pv.go:790] Waiting up to timeout=10m0s for PersistentVolumeClaims [nvmeof-pvc-clone] to have phase Bound
  I0608 13:16:35.505343   79259 pv.go:801] PersistentVolumeClaim nvmeof-pvc-clone found and phase=Bound (1.770669ms)
  I0608 13:16:35.505377   79259 pv.go:763] Waiting up to 10m0s for PersistentVolume pvc-ff99cd28-102e-47fc-8d14-8aaec7c9a280 to have phase Bound
  I0608 13:16:35.507083   79259 pv.go:771] PersistentVolume pvc-ff99cd28-102e-47fc-8d14-8aaec7c9a280 found and phase=Bound (1.688721ms)
  �[1mSTEP:�[0m Binding clone PVC to an application �[38;5;243m@ 06/08/26 13:16:35.51�[0m
  I0608 13:16:35.514333   79259 warnings.go:107] "Warning: would violate PodSecurity \"restricted:latest\": allowPrivilegeEscalation != false (container \"web-server\" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (container \"web-server\" must set securityContext.capabilities.drop=[\"ALL\"]), runAsNonRoot != true (pod or container \"web-server\" must set securityContext.runAsNonRoot=true), seccompProfile (pod or container \"web-server\" must set securityContext.seccompProfile.type to \"RuntimeDefault\" or \"Localhost\")"
  I0608 13:16:35.514428   79259 pod.go:377] Waiting up to 10m0s for csi-nvmeof-demo-pod-clone to be in Running state
  �[1mSTEP:�[0m Deleting the clone application and PVC �[38;5;243m@ 06/08/26 13:16:41.518�[0m

@nixpanic

nixpanic commented Jun 8, 2026

Copy link
Copy Markdown
Member

/test ci/centos/mini-e2e/k8s-1.35/nvmeof

@nixpanic

nixpanic commented Jun 8, 2026

Copy link
Copy Markdown
Member

/test ci/centos/mini-e2e/k8s-1.35/nvmeof

Running at https://jenkins-ceph-csi.apps.ocp.cloud.ci.centos.org/job/mini-e2e_k8s-1.35-nvmeof/67/display/redirect

@gadididi
gadididi requested a review from a team June 8, 2026 14:49
}

// Lock source volume to prevent concurrent deletion
if sourceVolumeID != "" {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lock on snapshot is not required?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Madhu-1 , I missed your comment here.
There is no need lock at nvmeof level for snapshot because the nvmeof snapshot call directly to rbd snapshot function..(and the rbd call has lock for that here- #6322). there are no more ops.
However, the cloning (which is running in CreateVolume()) call has nvmeof ops , so here need to use lock, prevent cloning + delete race

@mergify

mergify Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

This pull request now has conflicts with the target branch. Could you please resolve conflicts and force push the corrected changes? 🙏

@gadididi
gadididi force-pushed the nvmeof/clone_feature branch from 446ca9a to 9ea69b7 Compare July 14, 2026 08:58
@mergify
mergify Bot dismissed nixpanic’s stale review July 14, 2026 08:58

Pull request has been modified.

@nixpanic

Copy link
Copy Markdown
Member

/queue

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

@Mergifyio rebase

@mergify

mergify Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

rebase

🛑 The pull request rule doesn't match anymore

Details

This action has been cancelled.

gadididi added 2 commits July 28, 2026 12:47
enable volume cloning support for nvmeof CSI driver by declaring
CLONE_VOLUME capability. The RBD backend automatically handles all
clone operations (snapshot-to-volume restore and volume-to-volume
cloning) when VolumeContentSource is present in CreateVolume request.

The NVMeoF driver adds debug logging to track clone operations and
creates namespaces pointing to the cloned RBD images. No changes to
the NVMeoF gateway are required since clones are transparent at the
block device level.

Signed-off-by: gadi-didi <gadi.didi@ibm.com>
Add basic e2e test to validate PVC cloning functionality for nvmeof.
Test creates a source PVC, clones it using DataSource, and verifies
both can be deleted successfully.

Signed-off-by: gadi-didi <gadi.didi@ibm.com>
@ceph-csi-bot
ceph-csi-bot force-pushed the nvmeof/clone_feature branch from 007bda5 to 75e043f Compare July 28, 2026 12:47
@ceph-csi-bot ceph-csi-bot added ok-to-test Label to trigger E2E tests and removed queued/rebase labels Jul 28, 2026
@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.35

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.35

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.34

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/mini-e2e/k8s-1.35

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.34

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/mini-e2e/k8s-1.34

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.36

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.36

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/mini-e2e/k8s-1.36

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/upgrade-tests-cephfs

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/upgrade-tests-rbd

@ceph-csi-bot ceph-csi-bot added ci/in-progress/e2e This label acts like a guard and prevents Mergify from adding the `ok-to-test` label again. and removed ok-to-test Label to trigger E2E tests labels Jul 28, 2026
@mergify mergify Bot removed the ci/in-progress/e2e This label acts like a guard and prevents Mergify from adding the `ok-to-test` label again. label Jul 28, 2026
@gadididi

Copy link
Copy Markdown
Contributor Author

/test ci/centos/mini-e2e/k8s-1.35

@mergify

mergify Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Deprecation notice: This pull request comes from a fork and was queued with update_method=rebase and update_bot_account impersonation. This capability will be removed on July 1, 2026. After this date, the merge queue will no longer be able to rebase fork pull requests with this configuration. To avoid disruption, switch to update_method=merge in your queue rule.

@mergify

mergify Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-07-29 09:58 UTC · Rule: default · triggered by merge protections
  • Checks skipped · PR is already up-to-date
  • Merged2026-07-29 09:59 UTC · at 75e043f53bdb498c94ccf20b20bc335f732f05a3 · rebase

This pull request spent 26 seconds in the queue, including 5 seconds running CI.

Required conditions to merge

@mergify
mergify Bot merged commit b17a575 into ceph:devel Jul 29, 2026
43 checks passed
@gadididi
gadididi deleted the nvmeof/clone_feature branch July 29, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/nvme-of Issues and PRs related to NVMe-oF.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants